persist typescript vs python preference#2759
Conversation
Document that <CodeGroup>/<Tab> language labels must use canonical, consistent casing (Python/TypeScript/Bash) so the cross-page language preference matches, and that code-group-language-persist.js handles persistence globally. Also fix a stray "Typescript" in the lexer guidance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
a69bf17 to
1669e96
Compare
📚 Mintlify Preview Links📝 Changed (9 total)📄 Pages (8)
⚙️ Other (1)
🤖 Generated automatically when Mintlify deployment succeeds |
🔗 Link Checker Results✅ All links are valid! No broken links were detected. Checked against: https://wb-21fd5541-ncharriere-06-12-persist-typescript-vs-python-p.mintlify.app |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1669e962ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| python: 1, py: 1, typescript: 1, ts: 1, javascript: 1, js: 1, jsx: 1, | ||
| tsx: 1, node: 1, 'node.js': 1, nodejs: 1, bash: 1, shell: 1, sh: 1, |
There was a problem hiding this comment.
Keep Bash tabs from overwriting SDK preference
Because this global preference stores every whitelisted tab label, clicking an existing Bash tab, such as the Python/Bash examples under inference/response-settings/*.mdx, overwrites a user's saved TypeScript preference with Bash. Subsequent Weave pages whose SDK tabs are only Python/TypeScript have no Bash match, so they fall back to the first tab until the reader reselects TypeScript, which defeats the TypeScript-vs-Python persistence this script is meant to provide. Consider limiting persisted labels to SDK-language choices that should apply across pages, or scoping non-SDK choices per tab group.
Useful? React with 👍 / 👎.
Narrow the cross-page language whitelist in code-group-language-persist.js to Python and TypeScript. Previously any whitelisted label (Bash, shell, cURL, YAML, etc.) was persisted, so clicking e.g. a Bash tab overwrote the saved Python/TypeScript choice; a later page whose tabs are only Python/TypeScript then had no match and fell back to its first tab, defeating the persistence. Restore is case-insensitive, so the canonical labels cover python/Python/TypeScript alike. AGENTS.md updated to match. Addresses the Codex review on the PR.

Description
I was very frustrated as a TypeScript user navigating the docs because the website kept forgetting my preference of showing me typescript examples over python ones.
This writes a little script that injects the preference into localStorage and honors it in the future if using the same browser.
More changes than you'd think because we needed to normalize
Typescript->TypeScriptcasing + added instructions for future agents making changes to honor this conventin